www.gusucode.com > 基于马尔科夫随机场的图像分割matlab源码。包括ICM迭代条件模式求解最大后验概率算法 > code23/matlab MRF toy examples/runBP.m
% runBP.m % script initializes things and runs the BP functions. % Sept. 3, 2003 wtf created. See notesJuly11.txt for documentation. initPaths; initZoom; nIter = 10; n0 = 1; delta = 0.2; [segmentations{n0}, depths{n0}, disparImage{n0}, lhoods{n0}] = ... getSegDisp(images, rect, calib, n0, dset, sigma); segments = segmentations{n0}; lhoods = lhoods{n0}; [neighborMat] = getNeighborMat(segments); propMat = makePropMat(delta, length(dset)); nodes = initNodes (neighborMat, lhoods); figure; ind = 7; for i = 1:nIter nodes = propNodes(nodes, propMat); nodes = computeBeliefs(nodes); subplot(nIter,1,i); plot(nodes{ind}.belief); end;